home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1997-04-29 | 7.5 KB | 159 lines | [ TEXT/CWIE]
#ifndef __Assembler__ #include <Assembler.h> #endif #include "TrapAvailable.h" /* ; CDIconKiller © 1994, 1997 Quinn & Peter N Lewis, Fabrizio Oddone ; Version 1.0 written in 4 hours from 02:00 to 05:30 18/June/94 bug fixes, CD driver string in resource (suggested by Quinn), asm tweaks, cdev trickery, etc. (version 1.1 thru 1.4.x) by Fabrizio Oddone ; Patches GetCatInfo, tests for Custom Icon attribute on ; CD-ROM files/folders, and clears it. ; Detailed description: ; now runs as a cdev so the patch affects only the Finder ; since there is no user interface, we can retain the old icon ; macDev time: ; check if we are running under System 7 or later ; check if the patch is already installed ; load the resource containing the driver strings ; patch GetCatInfo ; initDev time: ; we are done, quit silently ; GetCatInfo patch: ; Test for GetCatInfo selector on _HFSDispatch, do nothing otherwise ; Call thru ; Return immediately on error or async call ; Return immediately unless Custom Icon bit set ; Walk the volume queue looking for the vRefNum of the GetCatInfo ; If we don't find it, we leave ; If the command key is down, we leave ; We determine whether the driver refnum is known (yes/no custom icons) ; If "no", then clear the custom icon bit ; If "yes", then leave ; If the driver refnum is NOT known, we scan the driver queue and update our lists include 'sysequ.a' include 'fsequ.a' include 'traps.a' ; procedure ShowIcon (id: integer; delta_x: integer); import ShowIcon */ //main proc export //extern pascal void ShowIcon(short iconID, short pixels); static void mypatch(void); //#define patchSize (EndHFSDispatch - OurHFSDispatch) #define patchSize (526) // because of CodeWarrior asm limitations #define HFSDispatchTrapNum 0x60 pascal long main(short message, short /*item*/, short /*numItems*/, short /*cPanelID*/, EventRecord */*theEvent*/, long cdevValue, DialogPtr /*cpDialog*/) { long resp; if (cdevValue) { switch (message) { case initDev: return cdevGenErr; break; ca notram: move.w d3,d4 sub.w 0x1d2,d4 // calc driver refnum -(unit num+1) LMGetUnitTableEntryCount() subq.w #1,d4 tst.b d5 bne.s firsttime move.w d4,d1 bsr finddriverdontwantcustomicons bne.s endloop bsr finddriverwantcustomicons bne.s endloop firsttime: lea struct (DRVRHeader.drvrName)(a0),a0 moveq #0,d2 move.b (a0)+,d2 swap d2 bsr cmpallstrings bne.s endloopsavedriver movea.l a3,a1 bra.s commonpart endloopsavedriver: movea.l a4,a1 commonpart: movea.l (a1),a0 move.w d4,(a0)+ // remember driver refnum move.l a0,(a1) endloop: subq.w #1,d3 bne loop plainexit: movem.l (sp)+,a0-a4/a6/d1/d3-d5 rts // input: a0 string, d2 (already in hi word) length // output: sets the flags // registers are saved&restored by the caller cmpallstrings: movea.l stringH,a6 movea.l (a6),a6 move.w (a6)+,d1 andi #0xB,CCR bra.s thedbcc cmploop: move.l d2,d0 move.b (a6)+,d0 movea.l a6,a1 adda.w d0,a6 _CmpString thedbcc: dbeq d1,cmploop cmpexit: rts skipthesedrivers: ds.w 15 lastskipthesedrivers: dc.w -1 otherdrivers: ds.w 63 lastotherdrivers: dc.w -1 nextfreedontwant: dc.l 0 nextfreewant: dc.l 0 stringH: dc.l 0 oldHFSDispatch: dc.l 0xffffffff EndHFSDispatch: // string pascal } // endp // end /* asm -wb "{active}" (evaluate "{active}" =~ "/(?*:)®1(?*)/" )> dev:null (evaluate "{active}" =~ "/(?*)®2.a/" )> dev:null link -rt INIT=128 -ra =ressysheap,reslocked -t INIT -c CDik -o "{®2}" "{active}.o" "{®1}ShowIcon.o" setfile -a B "{®2}" dumpobj "{®1}SHOWICON.o" */